package server;

/**
 * @program: stage_2_module_1
 * @description:
 * @author: zhangxiaoyang
 * @date: 2020/8/4 11:33 上午
 **/
public final class Mapper {

    protected MappedHost[] hosts = new MappedHost[1];

    protected abstract static class MapElement<T> {

        public final String name;
        public final T object;

        public MapElement(String name, T object) {
            this.name = name;
            this.object = object;
        }
    }

    protected static final class MappedHost extends MapElement<Host> {

        public ContextList contextList;


        public MappedHost(String name, Host host) {
            super(name, host);
            this.contextList = new ContextList();
        }

        public ContextList getContextList() {
            return contextList;
        }

        public void setContextList(ContextList contextList) {
            this.contextList = contextList;
        }
    }

    protected static final class ContextList {

        public final MappedContext[] contexts;


        public ContextList(MappedContext[] contexts) {
            this.contexts = contexts;
        }


        public ContextList() {
            this.contexts = new MappedContext[0];
        }
    }

    protected static final class MappedContext extends MapElement<Context> {

        public MappedWrapper[] wrappers = new MappedWrapper[0];

        public MappedContext(String name, Context context) {
            super(name, context);
        }

        public MappedWrapper[] getWrappers() {
            return wrappers;
        }

        public void setWrappers(MappedWrapper[] wrappers) {
            this.wrappers = wrappers;
        }
    }

    protected static class MappedWrapper extends MapElement<Wrapper> {

        public MappedWrapper(String name, Wrapper wrapper) {
            super(name, wrapper);
        }
    }
}
